<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->

<title>initscr</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<xref type="10" name="initscr"></xref>
<h4><a name = "tag_000_000_567">&nbsp;</a>NAME</h4><blockquote>
initscr, newterm - screen initialisation functions
</blockquote><h4><a name = "tag_000_000_568">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="curses.h.html">curses.h</a>&gt;

WINDOW *initscr(void);

SCREEN *newterm(char *<i>type</i>, FILE *<i>outfile</i>, FILE *<i>infile</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_000_569">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>initscr()</i>
function determines the terminal type and initialises all implementation data
structures.  The
environment variable specifies the terminal type.  The
<i>initscr()</i>
function also causes the first refresh operation to clear the screen.  If
errors occur,
<i>initscr()</i>
writes an appropriate error message to standard error and exits.
The only functions that can be called before
<i>initscr()</i>
or
<i><a href="newterm.html">newterm()</a></i>
are
<i><a href="filter.html">filter()</a></i>,
<i><a href="ripoffline.html">ripoffline()</a></i>,
<i><a href="slk_init.html">slk_init()</a></i>,
<i><a href="use_env.html">use_env()</a></i>
and the functions whose prototypes are defined in
<i><a href="term.h.html">&lt;term.h&gt;</a></i>.
Portable applications must not call
<i>initscr()</i>
twice.
<p>
The
<i><a href="newterm.html">newterm()</a></i>
function can be called as many times as desired to attach a terminal device.
The <i>type</i> argument points to a string specifying the terminal type,
except that if <i>type</i> is a null pointer, the
environment variable is used.  The <i>outfile</i> and <i>infile</i> arguments
are file pointers for output to the terminal and input from the terminal,
respectively.  It is unspecified whether Curses
modifies the buffering mode of these file pointers.  The
<i><a href="newterm.html">newterm()</a></i>
function should be called once for each terminal.
<p>
The
<i>initscr()</i>
function is equivalent to:
<pre>
<code>
newterm(getenv("TERM"), stdout, stdin);
return stdscr;
</code>
</pre>
If the current disposition for the signals SIGINT, SIGQUIT or SIGTSTP is
SIGDFL, then
<i>initscr()</i>
may also install a handler for the signal, which may remain in effect for the
life of the process or until the process changes the disposition of the
signal.
<p>
The
<i>initscr()</i>
and
<i><a href="newterm.html">newterm()</a></i>
functions initialise the
<i>cur_term</i>
external variable.
</blockquote><h4><a name = "tag_000_000_570">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion,
<i>initscr()</i>
returns a pointer to
<i>stdscr</i>.
Otherwise, it does not return.
<p>
Upon successful completion,
<i><a href="newterm.html">newterm()</a></i>
returns a pointer to the specified terminal.  Otherwise, it returns a
null pointer.
</blockquote><h4><a name = "tag_000_000_571">&nbsp;</a>ERRORS</h4><blockquote>
No errors are defined.
</blockquote><h4><a name = "tag_000_000_572">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
A program that outputs to more than one terminal should use
<i><a href="newterm.html">newterm()</a></i>
for each terminal instead of
<i>initscr()</i>.
A program that needs an indication of error conditions, so it can continue to
run in a line-oriented mode if the terminal cannot support a screen-oriented
program, would also use this function.
<p>
Applications should perform any required handling of the SIGINT, SIGQUIT or
SIGTSTP signals before calling
<i>initscr()</i>.
</blockquote><h4><a name = "tag_000_000_573">&nbsp;</a>SEE ALSO</h4><blockquote>
<xref href=selecterm></xref>,
<i><a href="delscreen.html">delscreen()</a></i>,
<i><a href="doupdate.html">doupdate()</a></i>,
<i><a href="del_curterm.html">del_curterm()</a></i>,
<i><a href="filter.html">filter()</a></i>,
<i><a href="slk_attroff.html">slk_attroff()</a></i>,
<i><a href="use_env.html">use_env()</a></i>,
<i><a href="curses.h.html">&lt;curses.h&gt;</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
